//
//  DDRTFirstViewController.m
//  DDRichTextDemo
//
//  Created by 张小伟 on 2021/9/19.
//

#import "DDRTFirstViewController.h"
#import "DDRTHeader.h"
#import "DDRTPreViewViewController.h"
#import "DDRTGroupListViewController.h"
@interface DDRTFirstViewController ()
@property(nonatomic,strong)UIButton *pinchTextBtn;

@property(nonatomic,strong)UIButton *sendTextBtn;
@end

@implementation DDRTFirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:self.pinchTextBtn];
    [self.view addSubview:self.sendTextBtn];
    
    self.pinchTextBtn.center = CGPointMake(kScreenWidth * 0.5, 200);
    self.pinchTextBtn.bounds = CGRectMake(0, 0, 200, 30);
    self.sendTextBtn.center = CGPointMake(kScreenWidth * 0.5, 300);
    self.sendTextBtn.bounds = CGRectMake(0, 0, 300, 30);
}

#pragma mark - Action Methods
-(void)btnClick:(UIButton *)btn {
    if (btn.tag - kBtnBaseTag == 0) { // 仿阅读效果
        DDRTPreViewViewController *vc = [[DDRTPreViewViewController alloc] init];
        vc.showConversationStr = @"这里的技术分享主要是对个人研究和学习新技术提供一个促进的方向，既没有特强烈的好为人师的想法，也没有流量变现的需求，核心目标是可以为个人未来技术发展素养提供更多养料，而这些养料就来自于个人所接触的技术后思考加工后的分享，以及所有看到个人技术后互相探讨的成果！";
        [self.navigationController pushViewController:vc animated:YES];
        
    }else { //
        DDRTGroupListViewController *vc = [[DDRTGroupListViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
}

#pragma mark - Settter & Getter

-(UIButton *)pinchTextBtn {
    if (!_pinchTextBtn) {
        _pinchTextBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_pinchTextBtn setTitle:@"仿私密阅读效果" forState:UIControlStateNormal];
        [_pinchTextBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        _pinchTextBtn.backgroundColor = [UIColor orangeColor];
        _pinchTextBtn.layer.cornerRadius = 5.0;
        _pinchTextBtn.layer.masksToBounds = YES;
        [_pinchTextBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        _pinchTextBtn.tag = kBtnBaseTag;
    }
    return _pinchTextBtn;
}

-(UIButton *)sendTextBtn {
    if (!_sendTextBtn) {
        _sendTextBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_sendTextBtn setTitle:@"TextView上放富文本按钮" forState:UIControlStateNormal];
        _sendTextBtn.backgroundColor = [UIColor redColor];

        [_sendTextBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        _sendTextBtn.layer.cornerRadius = 5.0;
        _sendTextBtn.layer.masksToBounds = YES;
        [_sendTextBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        _sendTextBtn.tag = kBtnBaseTag + 1;
    }
    return _sendTextBtn;
}

@end
